package cm.day13.Test1;

import java.io.DataInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        //创建一个ServerSocket的对象
        ServerSocket serverSocket=new ServerSocket(10086);
        //使用serverSocket对象，调用一个accept方法，等待客户端
        Socket accpt= serverSocket.accept();
        //从socket通信管道中得到一个字节输入流
        InputStream is=accpt.getInputStream();
        //转换成高效流
        DataInputStream dis=new DataInputStream(is);
        String str = dis.readUTF();
        System.out.println("客户端"+str);
        //必流
        accpt.close();
    }
}
